//
// Created by v on 19-4-22.
//

#ifndef CUTEDEVICE_CMAUTOTESTCOMMAND_H
#define CUTEDEVICE_CMAUTOTESTCOMMAND_H

#include "CMCommandInstance.h"
#include <map>

/**
 * CMCommandInstance (base)               ----- usage -----------
 * CMAutoTestCommand | (inherited) CMFifoHandler (create fifo )-> send message
 * to main program. CMTestKeyCommand, CMTestNetConfigAuto      ---- register
 * --->
 *
 * Implement CMTestxxxx with cmd, description, register it in CMAutoTestCommand
 * Than use main program with cmd (-a all, -c cmd) do all and special one.
 */

class CMAutoTestCommand
{
  public:
    CMAutoTestCommand();
    virtual ~CMAutoTestCommand();

    void initAllCmd();

    void showUsage(const std::string &name);

    // Start. Test command with @name
    int testStart(const std::string &name, int argc, char **args);

    // Test all
    int testAllAuto();

  protected:
    void registerCmd(std::string name, CMCommandInstance *cmd)
    {
        m_testCmd[name] = cmd;
    }

  private:
    std::map<std::string, CMCommandInstance *> m_testCmd;
};

#endif // CUTEDEVICE_CMAUTOTESTCOMMAND_H
